<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>飞机大战</title>
	</head>

	<body>
		<div id="stage" style="margin: 0 auto; width: 480px; height: 650px; text-align: center; vertical-align: middle" >
			<canvas id="canvas" style="border:2px solid red;" width="480" height="650">
				不支持画板对象
			</canvas>
		</div>
		<script>
			//创建Fish构造方法,存储鱼对象
			function Fish(type, color, weight) {
				this.type = type;
				this.color = color;
				this.weight = weight;
				this.eat = function() {
					alert(this.type + "在吃东西");
				}
			};
			//创建数组fishes
			var fishes = [];
			fishes[0] = new Fish("金鱼", "红色", 2);
			fishes[1] = new Fish("带鱼", "银色", 3);
			fishes[2] = new Fish("鲤鱼", "黑色", 4);

			//在警告框上显示鲤鱼的信息
			alert(fishes[2].type + " : " + fishes[2].color + " , " + fishes[2].weight);
			//调用鲤鱼对象的eat方法
			fishes[2].eat();
		</script>
	</body>
</html>